#ifndef TACS_H
#define TACS_H

#include "hash.h"

#define TAC_SYMBOL		1
#define TAC_LABEL		2
#define TAC_MOVE		3

#define TAC_REF			4
#define TAC_DEREF		5

/* Binary Operations */		 
#define TAC_ADD			6 
#define TAC_SUB			7 
#define TAC_MUL			8 
#define TAC_DIV			9 

#define TAC_LE		   10
#define TAC_GE         11
#define TAC_EQ		   12
#define TAC_NE		   13
#define TAC_AND	       14
#define TAC_OR         15
#define TAC_G          16
#define TAC_L		   17

#define TAC_BEGINFUN   18
#define TAC_ENDFUN	   19	 

#define TAC_IFZ		   20			
#define TAC_JUMP 	   21
		
#define TAC_CALL	   22
#define TAC_ARG		   23	 
#define TAC_RET		   24
	
#define TAC_PRINT	   25
#define TAC_READ	   26

#define TAC_VEC		   27
#define TAC_VECI	   28
#define TAC_VECR       29
#define TAC_VECW       30

#define TAC_VARI       31

#define MAX_SONS 4

typedef struct tac_node {
	int type;
	row *target;
	row *op1;
	row *op2;
	struct tac_node* prev;
	struct tac_node* next;
} TAC;

TAC* tac_create(int _type, row* _target, row* _op1, row* _op2);
TAC* tac_join(TAC* l1, TAC* l2);
void tac_print_single(TAC* t);
void tac_print_list(TAC* first);
void aux_print(row* _symbol);
TAC* tac_reverse(TAC* last);

#endif
